# Build stage
FROM maven:3.9.6-eclipse-temurin-17 AS build
WORKDIR /app
COPY ../pom.xml ./pom.xml
COPY ../common ./common
COPY pom.xml ./gateway/pom.xml
COPY src ./gateway/src
RUN mvn -q -DskipTests -f gateway/pom.xml package

# Run stage
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /app/gateway/target/*.jar app.jar
ENV SPRING_PROFILES_ACTIVE=docker
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app/app.jar"]
